home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr27 / gs26.zip / WINMAPS.PS < prev    next >
Text File  |  1993-04-10  |  4KB  |  110 lines

  1. %    Copyright (C) 1993 Aladdin Enterprises.  All rights reserved.
  2. %    Distributed by Free Software Foundation, Inc.
  3. %
  4. % This file is part of Ghostscript.
  5. %
  6. % Ghostscript is distributed in the hope that it will be useful, but
  7. % WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. % to anyone for the consequences of using it or for whether it serves any
  9. % particular purpose or works at all, unless he says so in writing.  Refer
  10. % to the Ghostscript General Public License for full details.
  11. %
  12. % Everyone is granted permission to copy, modify and redistribute
  13. % Ghostscript, but only under the conditions described in the Ghostscript
  14. % General Public License.  A copy of this license is supposed to have been
  15. % given to you along with Ghostscript so you can know your rights and
  16. % responsibilities.  It should be in a file named COPYING.  Among other
  17. % things, the copyright notice and this notice must be preserved on all
  18. % copies.
  19.  
  20. % winmaps.ps - make maps between PostScript encodings and Windows
  21. % character sets.
  22.  
  23. % Define the two Windows encodings.
  24.  
  25. /ANSIEncoding
  26.   ISOLatin1Encoding 256 array copy
  27.   dup 16#90 /.notdef put
  28.   16#93 1 16#9f { 2 copy /.notdef put pop } for
  29. def
  30.  
  31. /OEMEncoding [
  32.   /.notdef /.notdef /.notdef /heart /diamond /club /spade /bullet
  33.     8 { /.notdef } repeat
  34.   /.notdef /.notdef /.notdef /.notdef /paragraph /section /.notdef /.notdef
  35.     /arrowup /arrowdown /arrowright /arrowleft /.notdef /arrowboth /.notdef /.notdef
  36.   StandardEncoding 32 96 getinterval aload pop
  37.   /Ccedilla /udieresis /eacute /acircumflex /adieresis /agrave /aring /ccedilla
  38.     /ecircumflex /edieresis /egrave /idieresis /igrave /Adieresis /Aring
  39.   /Eacute /ae /AE /ocircumflex /odieresis /ograve /ucircumflex /ugrave
  40.     /ydieresis /Odieresis /Udieresis /cent /sterling /yen /.notdef /floring
  41.   /aacute /iacute /oacute /uacute /ntilde /Ntilde /ordfeminine /ordmasculine
  42.     /questiondown /.notdef /logicalnot /onehalf /onequarter /exclamdown /guillemotleft /guillemotright
  43.   48 { /.notdef } repeat
  44.   /alpha /beta /Gamma /Pi /Sigma /sigma /mu /tau
  45.     /Phi /Theta /Omega /delta /infinity /phi /element /intersection
  46.   /equivalence /plusminus /greaterequal /lessequal /integraltp /integralbt /divide /.notdef
  47.     /degree /dotmath /periodcentered /radical /.notdef /twosuperior /.notdef /.notdef
  48. ] def
  49.  
  50. % Utility procedures
  51.  
  52. /invertencoding        % <array> invertencoding <dict>
  53.  { 256 dict exch dup length 1 sub -1 0
  54.     {    % stack: dict array index
  55.       2 copy get /.notdef ne
  56.        { 2 copy get exch 3 index 3 1 roll put }
  57.        { pop }
  58.       ifelse
  59.     } for
  60.    pop
  61.  } def
  62.  
  63. /pmarray 256 array def
  64. /printmap        % <chars> <decode> printmap -
  65.  { mark 3 1 roll exch
  66.     { 2 copy known { 1 index exch get } { pop 0 } ifelse exch
  67.     }
  68.    forall pop
  69.    pmarray 0 counttomark 2 sub getinterval astore
  70.    ([) print dup length =only 0 exch (] = {\n  ) exch
  71.     { exch print =only
  72.       1 add 15 and dup 0 eq { (,\n  ) } { (, ) } ifelse
  73.     }
  74.    forall pop pop (\n};\n) print pop
  75.  } def
  76.  
  77. /decodeStd StandardEncoding invertencoding def
  78. /decodeISO ISOLatin1Encoding
  79.     % Remove the redundant characters
  80.   dup length array copy
  81.   [8#222 8#225 8#230 8#233 8#240] { 2 copy /.notdef put pop } forall
  82. invertencoding def
  83. /decodeSym SymbolEncoding invertencoding def
  84.  
  85. /decodeANSI ANSIEncoding invertencoding def
  86. /decodeOEM OEMEncoding invertencoding def
  87.  
  88. % Construct the map from Symbol to OEM.
  89.  
  90. (\nprivate const byte far_data gs_map_symbol_to_oem) print
  91. SymbolEncoding decodeOEM printmap
  92.  
  93. % Construct the map from ISOLatin1 to OEM.
  94.  
  95. (\nprivate const byte far_data gs_map_iso_to_oem) print
  96. ISOLatin1Encoding decodeOEM printmap
  97.  
  98. % Construct the map from Standard to ISOLatin1.
  99.  
  100. (\nprivate const byte far_data gs_map_std_to_iso) print
  101. StandardEncoding decodeISO printmap
  102.  
  103. % Construct the map from ISOLatin1 to Standard.
  104. % The Windows driver doesn't need this, but the X11 driver does.
  105.  
  106. (\nprivate const byte far_data gs_map_iso_to_std) print
  107. ISOLatin1Encoding decodeStd printmap
  108.  
  109. quit
  110.